package org.diysearch.services;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.diysearch.helpers.UserHelper;
import org.diysearch.interfaces.Product;
import org.diysearch.models.User;
import org.diysearch.products.HtmlProduct;

public class Dashboard extends BaseService {
	private String uri;
	private String completed;
	public Dashboard(String completed) {
		this.completed=completed;
	}
	@Override
	public Product execute() throws Exception {
		Product p = new HtmlProduct();
		p.setWriter(writer);
		
		HttpSession session = request.getSession();
		User _u = (User) session.getAttribute("user");
		User user = UserHelper.getUser(_u,new String[] {"-l","-t","-c"});
		Map<String,Object> content = new HashMap<String,Object>();
		content.put("user",user);
		
		p.setCompleted(completed, request, response, template, content);
		
		return p;
	}

	@Override
	public boolean isWriter() {
		return true;
	}

	@Override
	public String getUri() {
		return uri;
	}

	@Override
	public void setUri(String uri) {
		this.uri = uri;
	}

}
